package com.chendx.store.search.mq.queue;

import com.chendx.store.common.constants.goods.GoodsConstants;
import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created by chendx on 2022/5/12.
 */
@Configuration
public class QueueConfig {

    @Bean
    public Exchange basicExchange(){
        return ExchangeBuilder.directExchange(GoodsConstants.SKU_UPDATE_TOPIC).build();
    }

    @Bean
    public Queue updateSkuQueue(){
        return new Queue("search_sku_update_queue",true);
    }

    @Bean
    public Binding bind()
    {
        return BindingBuilder.bind(updateSkuQueue()).to(basicExchange()).with("").noargs();
    }
}
